{% extends 'base.html' %}

{% block body %}
    <div class="tw:flex tw:w-full tw:flex-col tw:items-center">
        <div class="tw:w-full tw:max-w-screen-md tw:flex tw:flex-col">
            <h1 class="tw:text-2xl">
                {% if object.full_name|cut:" " %}
                    {{ object.full_name }}({{ object.username }})
                {% else %}
                    {{ object.username }}
                {% endif %}
                
                {% if object.is_researcher %}
                    <div class="tw:text-xs tw:badge-soft tw:badge tw:badge-netural">{% trans '研究者' %}</div>
                {% endif %}
            </h1>

            <div class="tw:relative tw:max-h-40 tw:overflow-y-auto">
                {{ object.bio }}
            </div>

            <div class="tw:h-2"></div>
            
            <div class="tw:border tw:rounded tw:flex tw:flex-col tw:p-2">
                <div class="tw:text-sm tw:text-gray-500">
                    {% trans '个人信息' %}
                </div>
                
                <div class="tw:h-1"></div>
                
                <div class="tw:flex tw:flex-wrap">
                    <div class="tw:basis-1/2">{% trans '邮箱' %} <span class="tw:text-gray-700">{{ object.email }}</span></div>
                    <div class="tw:basis-1/2">{% trans '公司' %} <span class="tw:text-gray-700">{{ object.company }}</span></div>
                    <div class="tw:basis-1/2">{% trans '电话' %} <span class="tw:text-gray-700">{{ object.telephone }}</span></div>
                </div>
            </div>

            <div class="tw:h-2"></div>

            {% if object.is_researcher %}
                <div class="tw:border tw:rounded tw:flex tw:flex-col tw:p-2 tw:max-w-screen-md">
                    <div class="tw:text-sm tw:text-gray-500">
                        {% trans '简历列表' %}
                    </div>
                    
                    <div class="tw:h-1"></div>
                    
                    <div class="tw:overflow-x-auto">
                        <table class="tw:table">
                            <thead>
                                <tr>
                                    <th></th>
                                    <th>{% trans '上传时间' %}</th>
                                    <th>{% trans '文件' %}</th>
                                    <th>{% trans '操作' %}</th>
                                </tr>
                                <tbody>
                                    {% for r in resumes %}
                                        <tr class='{% if not r.can_access %}tw:text-gray-500 {% endif %}tw:hover'
                                            data-resume-uuid="{{ r.resume.uuid }}"
                                            data-resume-filename="{{ r.resume.filename }}"
                                            data-resume-content-type="{{ r.resume.content_type }}"
                                        >
                                            <th>{{ forloop.counter }}</th>
                                            <td>{{ r.resume.uploaded_at }}</td>
                                            <td data-filename-col>{{ r.resume.filename }}</td>
                                            <td>
                                                {% if r.can_access %}
                                                    <a class="tw:btn tw:btn-xs" data-download-resume-btn>
                                                        {% trans '下载' %}
                                                    </a>
                                                {% else %}
                                                    <a class="tw:btn tw:btn-xs" data-request-access-btn>
                                                        {% trans '申请访问权限' %}
                                                    </a>
                                                {% endif %}
                                            </td>
                                        </tr>
                                    {% endfor %}
                                </tbody>
                            </thead>
                        </table>
                    </div>
                </div>
            {% endif %}
        </div>
    </div>
{% endblock %}



